﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		AreaHelper.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 // 
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System.Web.Mvc;
using System.Web.Routing;

namespace Dexter.Web.Mvc.ViewEngines {

	#region Usings

	#endregion

	internal static class AreaHelper {
		public static string GetAreaName ( RouteData routeData ) {
			object obj2;
			if ( routeData.DataTokens.TryGetValue ( "area" , out obj2 ) ) {
				return ( obj2 as string );
			}
			return GetAreaName ( routeData.Route );
		}

		public static string GetAreaName ( RouteBase route ) {
			IRouteWithArea area = route as IRouteWithArea;
			if ( area != null ) {
				return area.Area;
			}
			Route route2 = route as Route;
			if ( ( route2 != null ) && ( route2.DataTokens != null ) ) {
				return ( route2.DataTokens[ "area" ] as string );
			}
			return null;
		}
	}
}
